<%@ include file="../common.jsp"%>
 
 <script type="text/javascript">
	$(document).ready(function() {
				$("#saveUnitTypeDetails").attr("action",'<c:url value="/editBusinessUnitTypeDetails.htm"></c:url>');
			});
		
</script>

<div>
 <c:choose>
 	<c:when test="${size > 0}">
	 	 <form name="editBusinessUnitType" id="editBusinessUnitType">
	 	 	<div style="width: 70%;">
				<table class="viewDetails">
					<tr class="adminTableMainHeaderColor tableChildHeaderFont">
						<th colspan="3"> LIST OF BUSINESS UNIT TYPE(S)</th>
					</tr>
					<tr class="heading">
						<th> Select </th>
						<th> Name </th>
						<th> Code </th>
					</tr>	
				
					<c:forEach items="${businessUnitList}" var="item" varStatus="loop">
						<c:set var="tabColor" value="odd"></c:set>
					     	<c:if test="${(loop.index % 2) eq 0}">
					        	<c:set var="tabColor" value="even"></c:set>
					        </c:if>
					<tr class="${tabColor}">
						<td align="center"> <input type="radio" id="radio${index.index}" name="radio" value="${item.key},${item.value}"/> </td>
						<td> ${item.value} </td>
						<td> ${item.key} </td>
					</tr>	
					</c:forEach>	
				</table>
				<table>
					<tr align="left">
						<td colspan="3">
							<input class="formButton ui-corner-all" type="button" value="SELECT" onclick="submitBusinessUnitTypeDetailsToEdit();" />
						</td>
					</tr>
				</table>
			</div>
		</form>
		
		<c:if test="${resultOfSave}">
			Operation Done Successfully.
		</c:if>
		
		<br>
		<hr/>
		<br>		
		
		<form:form commandName="businessUnitTypeDTO" id="saveUnitTypeDetails">
			<table class="adminFilterTable">
				<tr class="adminTableMainHeaderColor tableChildHeaderFont">
					<th colspan="5"> EDIT BUSINESS UNIT TYPE DETAILS </th>
				</tr>
				<tr class="formSpacingRow"><td></td> </tr>
				<tr class="formSpacingRow"><td></td> </tr>
				<tr>
					<td class="spacingColumnWidthLess"></td>
					<td class="formLabel"> Code* </td>
					<td class="spacingColumnWidthLess"></td>	
					<td class="formField"> <form:input path="buTypeCode" id="typeCode" readonly="true"></form:input> 
						 <form:errors path="buTypeName" cssClass="errorMsg"/> 
					</td>
					<td class="spacingColumnWidthLess"></td>
				</tr>
				<tr class="formSpacingRow"><td></td> </tr>
				<tr>
					<td class="spacingColumnWidthLess"></td>
					<td class="formLabel"> Name* </td>
					<td class="spacingColumnWidthLess"></td>	
					<td class="formField"> <form:input path="buTypeName" id="typeName"/> 
						 <form:errors path="buTypeCode" cssClass="errorMsg"/> 
					</td>
					<td class="spacingColumnWidthLess"></td>
				</tr>
				<tr class="formSpacingRow"><td></td> </tr>
				<tr class="even" align="center">
					<td class="spacingColumnWidthLess"></td>
					<td></td>
					<td class="spacingColumnWidthLess"></td>
					<td colspan="2" align="left"> <input type="button" class="formButton ui-corner-all" value="UPDATE" onclick="javascript:addEntity('saveUnitTypeDetails')"> </td>
				</tr>
				<tr class="formSpacingRow"><td></td> </tr>
			</table>
		</form:form>
		</c:when>
		<c:otherwise>
			No Records Found.
		</c:otherwise>
	</c:choose>
</div>